{extend name="admin@public/content"}

{block name="content"}
<form autocomplete="off" onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post"
      class='form-horizontal layui-form padding-top-20'>

    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            开启验证码
        </label>
        <div class='col-sm-8'>
            <input type="radio" name="captcha" value="0" title="关闭验证" {if $vo.captcha==0}checked=""{/if}>
            <input type="radio" name="captcha" value="1" title="开启点选验证" {if $vo.captcha==1}checked=""{/if}>
            <input type="radio" name="captcha" value="2" title="开启滑块验证" {if $vo.captcha==2}checked=""{/if}>
            <p class="help-block">开启后投票需要输入验证码</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            开启警告
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="warn_status" value="0" title="关闭" {if $vo.warn_status==0}checked{/if} lay-ignore>  关闭
            </label>
            <label class="think-radio">
                <input type="radio" name="warn_status" value="1" title="开启" {if $vo.warn_status==1}checked{/if} lay-ignore>  开启
            </label>
            <p class="help-block">开启后当投票量在一定的时间内达到设定的阀值时会警告选手，期间不可以投票，直到未超过阀值时方可恢复。</p>
        </div>
    </div>

    <div class="form-group" data-warn_status="1">
        <label class="col-sm-1 control-label">
            规则设置
        </label>

        当 <input type="text" value="{$vo.warn_min}" name="warn_min" style="width:50px;line-height: 25px;text-align: center;color: red"> 分钟的投票量超过 <input type="text" value="{$vo.warn_vote}" name="warn_vote" style="width:50px;line-height: 25px;text-align: center;color: red"> 票时警告选手。
        报警发送给选手的信息内容：<input type="text" name="warn_msg" value="{$vo.warn_msg}" style="width:800px;;color: red">
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            自动锁定
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="lock_status" value="0" title="关闭" {if $vo.lock_status==0}checked{/if} lay-ignore>  关闭
            </label>
            <label class="think-radio">
                <input type="radio" name="lock_status" value="1" title="开启" {if $vo.lock_status==1}checked{/if} lay-ignore>  开启
            </label>
            <p class="help-block">开启后当投票量在一定的时间内达到设定的值(<font color="red">满足其中一种规则</font>)后会锁定选手,选手锁定后，只能浏览，但不能投票，只有在后台解锁后才可以继续投票。</p>
        </div>
    </div>

    <div class="form-group" data-lock_status="1">
        <label class="col-sm-1 control-label">
            1、规则设置(分)
        </label>

        当 <input type="text" value="{$vo.lock_min}" name="lock_min" style="width:50px;line-height: 25px;text-align: center;color: red"> 分钟的投票量超过 <input type="text" value="{$vo.lock_vote}" name="lock_vote" style="width:50px;line-height: 25px;text-align: center;color: red"> 票时自动锁定选手。
        锁定发送给选手的信息内容：<input type="text" name="lock_msg" value="{$vo.lock_msg}" style="width:800px;;color: red">
    </div>

    <div class="form-group" data-lock_status="1">
        <label class="col-sm-1 control-label">
            2、规则设置(时)
        </label>

        当 <input type="text" value="{$vo.lock_hour}" name="lock_hour" style="width:50px;line-height: 25px;text-align: center;color: red"> 小时的投票量超过 <input type="text" value="{$vo.lock_hour_vote}" name="lock_hour_vote" style="width:50px;line-height: 25px;text-align: center;color: red"> 票时自动锁定选手。
        锁定发送给选手的信息内容：<input type="text" name="lock_msg" value="{$vo.lock_msg}" style="width:800px;;color: red">
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            每天投票时间限制
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="limit_time_status" value="0" title="不限制" {if $vo.limit_time_status==0}checked{/if} lay-ignore>  不限制
            </label>
            <label class="think-radio">
                <input type="radio" name="limit_time_status" value="1" title="限制" {if $vo.limit_time_status==1}checked{/if} lay-ignore>  限制
            </label>
            <!--<p class="help-block">每天投票时间限制</p>-->
        </div>
    </div>

    <div class="form-group" data-time_limit-type="1">
        <label class="col-sm-1 control-label">
            投票开始时间
        </label>
        <div class='col-sm-1'>
            <input name="limitdate" id='limitdate' required="required" placeholder="投票开始时间"
                   value="{$vo.limitdate}" class="layui-input">
        </div>

        <label class="col-sm-1 control-label">
            投票结束时间
        </label>
        <div class='col-sm-1'>
            <input name="limitenddate" id='limitenddate' required="required" placeholder="投票结束时间"
                   value="{$vo.limitenddate}" class="layui-input">
        </div>
        <p class="help-block">每天可投票的开始时间-每天可投票的结束时间</p>
    </div>


    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            IP限制
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="limit_ip_status" value="0" title="不限制" {if $vo.limit_ip_status==0}checked{/if} lay-ignore>  不限制
            </label>
            <label class="think-radio">
                <input type="radio" name="limit_ip_status" value="1" title="限制" {if $vo.limit_ip_status==1}checked{/if} lay-ignore>  限制
            </label>
            <!--<p class="help-block">IP限制</p>-->
        </div>
    </div>

    <div class="form-group" data-ip-type="1">
        <label class="col-sm-1 control-label">
            限制IP投票次数
        </label>
        <div class='col-sm-8'>
            <input name="limit_vote_ip" required="required" title="限制IP请求次数" placeholder="限制IP请求次数" value="{$vo.limit_vote_ip}"
                   class="layui-input">
            <p class="help-block">限制每个ip投票次数,默认30次</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            地区限制
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="limit_area_status" value="0" title="不限制" {if $vo.limit_area_status==0}checked{/if} lay-ignore>  不限制
            </label>
            <label class="think-radio">
                <input type="radio" name="limit_area_status" value="1" title="限制省份" {if $vo.limit_area_status==1}checked{/if} lay-ignore>  限制省份
            </label>
            <label class="think-radio">
                <input type="radio" name="limit_area_status" value="2" title="限制城市" {if $vo.limit_area_status==2}checked{/if} lay-ignore>  限制城市
            </label>
        </div>
    </div>

    <div class="form-group" data-area-type="1">
        <label class="col-sm-1 control-label">
            限制可投票省份
        </label>
        <div class='col-sm-8'>
            <input name="limit_province" required="required" title="限制可投票省份" placeholder="限制可投票省份" value="{$vo.limit_province}"
                   class="layui-input">
            <p class="help-block">只允许指定地区投票,多个用,隔开,比如湖南省,湖北省</p>
        </div>
    </div>

    <div class="form-group" data-area-type="2">
        <label class="col-sm-1 control-label">
            限制可投票城市
        </label>
        <div class='col-sm-8'>
            <input name="limit_city" required="required" title="限制可投票城市" placeholder="限制可投票城市" value="{$vo.limit_city}"
                   class="layui-input">
            <p class="help-block">只允许指定城市投票,多个用,隔开,比如长沙市,湘潭市</p>
        </div>
    </div>

    <div class="hr-line-dashed"></div>


    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            投票记录延迟写入
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="delay_status" value="0" title="不延迟" {if $vo.delay_status==0}checked{/if} lay-ignore>  不延迟
            </label>
            <label class="think-radio">
                <input type="radio" name="delay_status" value="1" title="开启延迟" {if $vo.delay_status==1}checked{/if} lay-ignore>  开启延迟
            </label>
            <p class="help-block">根据系统运行情况设置，不清楚请勿设置</p>
        </div>
    </div>

    <div class="form-group" data-delay-type="1">
        <label class="col-sm-1 control-label">
            延迟多少秒
        </label>
        <div class='col-sm-8'>
            <input name="delay_time" required="required" title="输入延迟的秒数" placeholder="输入延迟的秒数" value="{$vo.delay_time}"
                   class="layui-input">
            <p class="help-block">输入延迟的秒数</p>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-1 control-label label-required">
            总流量限制
        </label>
        <div class='col-sm-8'>
            <label class="think-radio">
                <input type="radio" name="total_limit_status" value="0" title="关闭" {if $vo.total_limit_status==0}checked{/if} lay-ignore>  关闭
            </label>
            <label class="think-radio">
                <input type="radio" name="total_limit_status" value="1" title="开启" {if $vo.total_limit_status==1}checked{/if} lay-ignore>  开启
            </label>
            <p class="help-block">总流量限制,根据系统运行情况设置，不清楚请勿设置</p>
        </div>
    </div>

    <div class="form-group" data-total_limit_count-type="1">
        <label class="col-sm-1 control-label">
            总限制pv数
        </label>
        <div class='col-sm-8'>
            <input name="total_limit_count" required="required" title="输入总限制pv数" placeholder="输入总限制pv数" value="{$vo.total_limit_count}"
                   class="layui-input">
            <p class="help-block">输入总限制pv数(当前剩余:<span style="color: red">{$vo.left_limit_num}</span>),不清楚请勿设置</p>
        </div>
    </div>

    <div class="form-group" data-total_limit_count-type="1">
        <label class="col-sm-1 control-label">
            跳转url
        </label>
        <div class='col-sm-8'>
            <input name="total_jump_url" required="required" title="输入跳转url" placeholder="输入跳转url" value="{$vo.total_jump_url}"
                   class="layui-input">
            <p class="help-block">跳转url,不清楚请勿设置</p>
        </div>
    </div>


    <div class="col-sm-4 col-sm-offset-2">
        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存配置</button>
        </div>
    </div>

</form>

<script>

    window.laydate.render({
        range: false,
        type: 'time',
        format: 'HH:mm',
        elem: '#limitdate'
    });

    window.laydate.render({
        range: false,
        type: 'time',
        format: 'HH:mm',
        elem: '#limitenddate'
    });

</script>


<script>
    (function () {
        window.form.render();
        buildForm('{$vo.limit_time_status}');
        $('[name=limit_time_status]').on('click', function () {
            buildForm($('[name=limit_time_status]:checked').val())
        });

        // 表单显示编译
        function buildForm(value) {
            var $tips = $("[data-time_limit-type='" + value + "']");
            $("[data-time_limit-type]").not($tips.show()).hide();
        }

        buildIpForm('{$vo.limit_ip_status}');
        $('[name=limit_ip_status]').on('click', function () {
            buildIpForm($('[name=limit_ip_status]:checked').val())
        });

        // 表单显示编译
        function buildIpForm(value) {
            var $tips = $("[data-ip-type='" + value + "']");
            $("[data-ip-type]").not($tips.show()).hide();
        }

        buildDelayForm('{$vo.delay_status}');
        $('[name=delay_status]').on('click', function () {
            buildDelayForm($('[name=delay_status]:checked').val())
        });

        // 表单显示编译
        function buildDelayForm(value) {
            var $tips = $("[data-delay-type='" + value + "']");
            $("[data-delay-type]").not($tips.show()).hide();
        }

        buildAreaForm('{$vo.limit_area_status}');
        $('[name=limit_area_status]').on('click', function () {
            buildAreaForm($('[name=limit_area_status]:checked').val())
        });

        // 表单显示编译
        function buildAreaForm(value) {
            var $tips = $("[data-area-type='" + value + "']");
            $("[data-area-type]").not($tips.show()).hide();
        }

        buildWarnForm('{$vo.warn_status}');
        $('[name=warn_status]').on('click', function () {
            buildWarnForm($('[name=warn_status]:checked').val())
        });

        // 表单显示编译
        function buildWarnForm(value) {
            var $tips = $("[data-warn_status='" + value + "']");
            $("[data-warn_status]").not($tips.show()).hide();
        }

        buildLockForm('{$vo.lock_status}');
        $('[name=lock_status]').on('click', function () {
            buildLockForm($('[name=lock_status]:checked').val())
        });

        // 表单显示编译
        function buildLockForm(value) {
            var $tips = $("[data-lock_status='" + value + "']");
            $("[data-lock_status]").not($tips.show()).hide();
        }


        buildtotal_limit_statusForm('{$vo.total_limit_status}');
        $('[name=total_limit_status]').on('click', function () {
            buildtotal_limit_statusForm($('[name=total_limit_status]:checked').val())
        });

        // 表单显示编译
        function buildtotal_limit_statusForm(value) {
            var $tips = $("[data-total_limit_count-type='" + value + "']");
            $("[data-total_limit_count-type]").not($tips.show()).hide();
        }

    })();
</script>

<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer
            , form = layui.form;

    });
</script>
{/block}

